#import "EaseTipMessageCell.h"
@implementation EaseTipMessageCell
+ (void)initialize
{
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style
              reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.accessibilityIdentifier = @"table_cell1";
        [self _setupSubviews];
    }
    return self;
}
- (void)_setupSubviews
{
    self.backgroundColor = m1_bg_color;
    _label = [[UILabel alloc] initWithFrame:CGRectZero];
    _label.numberOfLines = 1;
    self.label.textColor = [UIColor whiteColor];;
    self.label.font = [UIFont systemFontOfSize:12.f];
    [self addSubview:_label];
    [_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.centerY.equalTo(self.mas_centerY);
        make.width.lessThanOrEqualTo(self.mas_width).offset(-40);
    }];
    UIView *view = [[UIView alloc]init];
    view.backgroundColor = [UIColor m1_colorHex:0xc9cacc];
    view.layer.cornerRadius = 11;
    [self insertSubview:view belowSubview:self.label];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.label.mas_left).offset(-10);
        make.centerY.equalTo(self.label.mas_centerY);
        make.centerX.equalTo(self.label.mas_centerX);
        make.height.mas_offset(22);
        make.right.equalTo(_label.mas_right).offset(10);
    }];
}
-(void)setModel:(id<IMessageModel>)model{
    _model = model;
    NSString *text = @"";
    if ([[model.message.ext m1_stringKey:@"hx_attr_exchange_wx"] boolValue]) {
        text = @"请求交换微信已发送";
    }
    if ([[model.message.ext m1_stringKey:@"hx_attr_refuse_exchange_wx_account"] boolValue]) {
        if (model.isSender) {
            text = model.message.ext[@"hx_attr_refuse_exchange_wx_account_my"];
        }else{
            text = model.message.ext[@"hx_attr_refuse_exchange_wx_account_other"];
        }
    }
    _label.text = text;
}
- (BOOL)canBecomeFirstResponder
{
    return YES;
}
+ (NSString *)cellIdentifierWithModel:(id<IMessageModel>)model
{
    return @"EaseTipMessageCell";
}
+ (CGFloat)cellHeightWithModel:(id<IMessageModel>)model
{
    return 44;
}
- (void)awakeFromNib {

    [super awakeFromNib];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    [super setSelected:selected animated:animated];
}
@end
